import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/query_params_entity.dart';

QueryParamsEntity $QueryParamsEntityFromJson(Map<String, dynamic> json) {
  final QueryParamsEntity queryParamsEntity = QueryParamsEntity();
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    queryParamsEntity.companyId = companyId;
  }
  final int? systemId = jsonConvert.convert<int>(json['systemId']);
  if (systemId != null) {
    queryParamsEntity.systemId = systemId;
  }
  final String? systemCode = jsonConvert.convert<String>(json['systemCode']);
  if (systemCode != null) {
    queryParamsEntity.systemCode = systemCode;
  }
  final String? deviceCode = jsonConvert.convert<String>(json['deviceCode']);
  if (deviceCode != null) {
    queryParamsEntity.deviceCode = deviceCode;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    queryParamsEntity.nodeName = nodeName;
  }
  return queryParamsEntity;
}

Map<String, dynamic> $QueryParamsEntityToJson(QueryParamsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyId'] = entity.companyId;
  data['systemId'] = entity.systemId;
  data['systemCode'] = entity.systemCode;
  data['deviceCode'] = entity.deviceCode;
  data['nodeName'] = entity.nodeName;
  return data;
}

extension QueryParamsEntityExtension on QueryParamsEntity {
  QueryParamsEntity copyWith({
    int? companyId,
    int? systemId,
    String? systemCode,
    String? deviceCode,
    String? nodeName,
  }) {
    return QueryParamsEntity()
      ..companyId = companyId ?? this.companyId
      ..systemId = systemId ?? this.systemId
      ..systemCode = systemCode ?? this.systemCode
      ..deviceCode = deviceCode ?? this.deviceCode
      ..nodeName = nodeName ?? this.nodeName;
  }
}